<template>
  <div>
    <div v-for="item in restaurants" :key="item._id" @click="toMenu(item._id)">
      <div>{{ item.name['zh-CN'] }}</div>
    </div>
  </div>
</template>

<script>
import config from '@/common/config';

export default {
  name: 'Restaurant',
  data() {
    return {
      restaurants: [],
    };
  },
  created() {
    this.getRestaurants();
  },
  methods: {
    async getRestaurants() {
      const result = await this.$request({
        url: `${config.server}/restaurant/location/-74.0059413,40.7127837`,
        method: 'get',
      });
      this.restaurants = result.list;
    },
    toMenu(id) {
      this.$router.push(`/menu/${id}`);
    },
  },
};
</script>

<style>
</style>
